package com.hlhj.carview.adapter

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hlhj.carview.R
import com.hlhj.carview.bean.AdvListBean
import com.hlhj.carview.http.Urls
import com.hlhj.carview.utils.GlideUtil

/**
 * Created by Never Fear   on 2018\12\24 0024.
Never More....
 */
class MyAdvAdp(private val datas:ArrayList<AdvListBean.InfoBean.DataBean>) :BaseQuickAdapter<AdvListBean.InfoBean.DataBean,BaseViewHolder>(R.layout.adv_item,datas) {
    override fun convert(helper: BaseViewHolder?, item: AdvListBean.InfoBean.DataBean?) {

        Glide.with(mContext).load(Urls.Img+item?.cover).apply(GlideUtil.loadAdOption()).into(helper?.getView(R.id.itemBg))
        helper?.setText(R.id.itemName,item?.advertising_name)
        helper?.setText(R.id.itemOwner,item?.advertiser)
        if (item?.type?.equals("1")!!){
            helper?.setVisible(R.id.itemTime,true)
            helper?.setText(R.id.itemTime,"${item?.play_time!!.toInt()/60}\"${item?.play_time!!.toInt()%60}")
        }else{
            helper?.setVisible(R.id.itemTime,false)
        }
    }
}